<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPixmap Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPixmap Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPixmap class is an off-screen image representation that can
be used as a paint device. <a href="#details">More...</a></p>

<p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.</p><p>Inherited by <a href="qbitmap.html">QBitmap</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qpixmap.html#ShareMode-enum">ShareMode</a></b> { ImplicitlyShared, ExplicitlyShared }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpixmap.html#QPixmap">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpixmap.html#QPixmap-2">__init__</a></b> (<i>self</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</li><li><div class="fn" /><b><a href="qpixmap.html#QPixmap-3">__init__</a></b> (<i>self</i>, QSize)</li><li><div class="fn" /><b><a href="qpixmap.html#QPixmap-4">__init__</a></b> (<i>self</i>, QString&#160;<i>fileName</i>, str&#160;<i>format</i>&#160;=&#160;None, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpixmap.html#QPixmap-5">__init__</a></b> (<i>self</i>, list-of-str&#160;<i>xpm</i>)</li><li><div class="fn" /><b><a href="qpixmap.html#QPixmap-6">__init__</a></b> (<i>self</i>, QPixmap)</li><li><div class="fn" /><b><a href="qpixmap.html#QPixmap-7">__init__</a></b> (<i>self</i>, QVariant&#160;<i>variant</i>)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#alphaChannel">alphaChannel</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpixmap.html#cacheKey">cacheKey</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpixmap.html#convertFromImage">convertFromImage</a></b> (<i>self</i>, QImage&#160;<i>img</i>, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#copy">copy</a></b> (<i>self</i>, QRect&#160;<i>rect</i>&#160;=&#160;QRect())</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#copy-2">copy</a></b> (<i>self</i>, int&#160;<i>ax</i>, int&#160;<i>ay</i>, int&#160;<i>awidth</i>, int&#160;<i>aheight</i>)</li><li><div class="fn" />QBitmap <b><a href="qpixmap.html#createHeuristicMask">createHeuristicMask</a></b> (<i>self</i>, bool&#160;<i>clipTight</i>&#160;=&#160;True)</li><li><div class="fn" />QBitmap <b><a href="qpixmap.html#createMaskFromColor">createMaskFromColor</a></b> (<i>self</i>, QColor&#160;<i>maskColor</i>, Qt.MaskMode&#160;<i>mode</i>)</li><li><div class="fn" />QBitmap <b><a href="qpixmap.html#createMaskFromColor-2">createMaskFromColor</a></b> (<i>self</i>, QColor&#160;<i>maskColor</i>)</li><li><div class="fn" />int <b><a href="qpixmap.html#depth">depth</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpixmap.html#detach">detach</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpixmap.html#devType">devType</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpixmap.html#fill">fill</a></b> (<i>self</i>, QColor&#160;<i>color</i>&#160;=&#160;Qt.white)</li><li><div class="fn" /><b><a href="qpixmap.html#fill-2">fill</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>, QPoint&#160;<i>ofs</i>)</li><li><div class="fn" /><b><a href="qpixmap.html#fill-3">fill</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>, int&#160;<i>xofs</i>, int&#160;<i>yofs</i>)</li><li><div class="fn" />int <b><a href="qpixmap.html#handle">handle</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpixmap.html#hasAlpha">hasAlpha</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpixmap.html#hasAlphaChannel">hasAlphaChannel</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpixmap.html#height">height</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpixmap.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpixmap.html#isQBitmap">isQBitmap</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpixmap.html#load">load</a></b> (<i>self</i>, QString&#160;<i>fileName</i>, str&#160;<i>format</i>&#160;=&#160;None, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" />bool <b><a href="qpixmap.html#loadFromData">loadFromData</a></b> (<i>self</i>, str&#160;<i>buf</i>, str&#160;<i>format</i>&#160;=&#160;None, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" />bool <b><a href="qpixmap.html#loadFromData-2">loadFromData</a></b> (<i>self</i>, QByteArray&#160;<i>buf</i>, str&#160;<i>format</i>&#160;=&#160;None, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" />QBitmap <b><a href="qpixmap.html#mask">mask</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpixmap.html#metric">metric</a></b> (<i>self</i>, QPaintDevice.PaintDeviceMetric)</li><li><div class="fn" />QPaintEngine <b><a href="qpixmap.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qpixmap.html#rect">rect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpixmap.html#save">save</a></b> (<i>self</i>, QString&#160;<i>fileName</i>, str&#160;<i>format</i>&#160;=&#160;None, int&#160;<i>quality</i>&#160;=&#160;-1)</li><li><div class="fn" />bool <b><a href="qpixmap.html#save-2">save</a></b> (<i>self</i>, QIODevice&#160;<i>device</i>, str&#160;<i>format</i>&#160;=&#160;None, int&#160;<i>quality</i>&#160;=&#160;-1)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#scaled">scaled</a></b> (<i>self</i>, int&#160;<i>width</i>, int&#160;<i>height</i>, Qt.AspectRatioMode&#160;<i>aspectRatioMode</i>&#160;=&#160;Qt.IgnoreAspectRatio, Qt.TransformationMode&#160;<i>transformMode</i>&#160;=&#160;Qt.FastTransformation)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#scaled-2">scaled</a></b> (<i>self</i>, QSize&#160;<i>size</i>, Qt.AspectRatioMode&#160;<i>aspectRatioMode</i>&#160;=&#160;Qt.IgnoreAspectRatio, Qt.TransformationMode&#160;<i>transformMode</i>&#160;=&#160;Qt.FastTransformation)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#scaledToHeight">scaledToHeight</a></b> (<i>self</i>, int&#160;<i>height</i>, Qt.TransformationMode&#160;<i>mode</i>&#160;=&#160;Qt.FastTransformation)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#scaledToWidth">scaledToWidth</a></b> (<i>self</i>, int&#160;<i>width</i>, Qt.TransformationMode&#160;<i>mode</i>&#160;=&#160;Qt.FastTransformation)</li><li><div class="fn" />QRegion&#160;<i>exposed</i> <b><a href="qpixmap.html#scroll">scroll</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>, QRect&#160;<i>rect</i>)</li><li><div class="fn" />QRegion&#160;<i>exposed</i> <b><a href="qpixmap.html#scroll-2">scroll</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>width</i>, int&#160;<i>height</i>)</li><li><div class="fn" />int <b><a href="qpixmap.html#serialNumber">serialNumber</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpixmap.html#setAlphaChannel">setAlphaChannel</a></b> (<i>self</i>, QPixmap)</li><li><div class="fn" /><b><a href="qpixmap.html#setMask">setMask</a></b> (<i>self</i>, QBitmap)</li><li><div class="fn" />QSize <b><a href="qpixmap.html#size">size</a></b> (<i>self</i>)</li><li><div class="fn" />QImage <b><a href="qpixmap.html#toImage">toImage</a></b> (<i>self</i>)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#transformed">transformed</a></b> (<i>self</i>, QMatrix&#160;<i>matrix</i>, Qt.TransformationMode&#160;<i>mode</i>&#160;=&#160;Qt.FastTransformation)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#transformed-2">transformed</a></b> (<i>self</i>, QTransform&#160;<i>transform</i>, Qt.TransformationMode&#160;<i>mode</i>&#160;=&#160;Qt.FastTransformation)</li><li><div class="fn" />int <b><a href="qpixmap.html#width">width</a></b> (<i>self</i>)</li><li><div class="fn" />QX11Info <b><a href="qpixmap.html#x11Info">x11Info</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpixmap.html#x11PictureHandle">x11PictureHandle</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />int <b><a href="qpixmap.html#defaultDepth">defaultDepth</a></b> ()</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#fromImage">fromImage</a></b> (QImage&#160;<i>image</i>, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#fromImageReader">fromImageReader</a></b> (QImageReader&#160;<i>imageReader</i>, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#fromX11Pixmap">fromX11Pixmap</a></b> (int&#160;<i>pixmap</i>, ShareMode&#160;<i>mode</i>&#160;=&#160;QPixmap.ImplicitlyShared)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#grabWidget">grabWidget</a></b> (QWidget&#160;<i>widget</i>, QRect&#160;<i>rect</i>)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#grabWidget-2">grabWidget</a></b> (QWidget&#160;<i>widget</i>, int&#160;<i>x</i>&#160;=&#160;0, int&#160;<i>y</i>&#160;=&#160;0, int&#160;<i>width</i>&#160;=&#160;-1, int&#160;<i>height</i>&#160;=&#160;-1)</li><li><div class="fn" />QPixmap <b><a href="qpixmap.html#grabWindow">grabWindow</a></b> (int&#160;<i>window</i>, int&#160;<i>x</i>&#160;=&#160;0, int&#160;<i>y</i>&#160;=&#160;0, int&#160;<i>width</i>&#160;=&#160;-1, int&#160;<i>height</i>&#160;=&#160;-1)</li><li><div class="fn" />QMatrix <b><a href="qpixmap.html#trueMatrix">trueMatrix</a></b> (QMatrix&#160;<i>m</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</li><li><div class="fn" />QTransform <b><a href="qpixmap.html#trueMatrix-2">trueMatrix</a></b> (QTransform&#160;<i>m</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPixmap class is an off-screen image representation that can
be used as a paint device.</p>
<p>Qt provides four classes for handling image data: <a href="qimage.html">QImage</a>, QPixmap, <a href="qbitmap.html">QBitmap</a> and <a href="qpicture.html">QPicture</a>. <a href="qimage.html">QImage</a> is
designed and optimized for I/O, and for direct pixel access and
manipulation, while QPixmap is designed and optimized for showing
images on screen. <a href="qbitmap.html">QBitmap</a> is only a
convenience class that inherits QPixmap, ensuring a depth of 1. The
<a href="qpixmap.html#isQBitmap">isQBitmap</a>() function returns
true if a QPixmap object is really a bitmap, otherwise returns
false. Finally, the <a href="qpicture.html">QPicture</a> class is a
paint device that records and replays <a href="qpainter.html">QPainter</a> commands.</p>
<p>A QPixmap can easily be displayed on the screen using <a href="qlabel.html">QLabel</a> or one of <a href="qabstractbutton.html">QAbstractButton</a>'s subclasses (such as
<a href="qpushbutton.html">QPushButton</a> and <a href="qtoolbutton.html">QToolButton</a>). <a href="qlabel.html">QLabel</a> has a pixmap property, whereas <a href="qabstractbutton.html">QAbstractButton</a> has an icon
property.</p>
<p>In addition to the ordinary constructors, a QPixmap can be
constructed using the static <a href="qpixmap.html#grabWidget">grabWidget</a>() and <a href="qpixmap.html#grabWindow">grabWindow</a>() functions which creates
a QPixmap and paints the given widget, or window, into it.</p>
<p>QPixmap objects can be passed around by value since the QPixmap
class uses implicit data sharing. For more information, see the
<a href="implicit-sharing.html#implicit-data-sharing">Implicit Data
Sharing</a> documentation. QPixmap objects can also be
streamed.</p>
<p>Note that the pixel data in a pixmap is internal and is managed
by the underlying window system. Because QPixmap is a <a href="qpaintdevice.html">QPaintDevice</a> subclass, <a href="qpainter.html">QPainter</a> can be used to draw directly onto
pixmaps. Pixels can only be accessed through <a href="qpainter.html">QPainter</a> functions or by converting the QPixmap
to a <a href="qimage.html">QImage</a>. However, the <a href="qpixmap.html#fill">fill</a>() function is available for
initializing the entire pixmap with a given color.</p>
<p>There are functions to convert between <a href="qimage.html">QImage</a> and QPixmap. Typically, the <a href="qimage.html">QImage</a> class is used to load an image file,
optionally manipulating the image data, before the <a href="qimage.html">QImage</a> object is converted into a QPixmap to be
shown on screen. Alternatively, if no manipulation is desired, the
image file can be loaded directly into a QPixmap. On Windows, the
QPixmap class also supports conversion between <tt>HBITMAP</tt> and
QPixmap. On Symbian, the QPixmap class also supports conversion
between CFbsBitmap and QPixmap.</p>
<p>QPixmap provides a collection of functions that can be used to
obtain a variety of information about the pixmap. In addition,
there are several functions that enables transformation of the
pixmap.</p>
<a id="reading-and-writing-image-files" name="reading-and-writing-image-files" />
<h3>Reading and Writing Image Files</h3>
<p>QPixmap provides several ways of reading an image file: The file
can be loaded when constructing the QPixmap object, or by using the
<a href="qpixmap.html#load">load</a>() or <a href="qpixmap.html#loadFromData">loadFromData</a>() functions later on.
When loading an image, the file name can either refer to an actual
file on disk or to one of the application's embedded resources. See
<a href="resources.html">The Qt Resource System</a> overview for
details on how to embed images and other resource files in the
application's executable.</p>
<p>Simply call the <a href="qpixmap.html#save">save</a>() function
to save a QPixmap object.</p>
<p>The complete list of supported file formats are available
through the <a href="qimagereader.html#supportedImageFormats">QImageReader.supportedImageFormats</a>()
and <a href="qimagewriter.html#supportedImageFormats">QImageWriter.supportedImageFormats</a>()
functions. New file formats can be added as plugins. By default, Qt
supports the following formats:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Format</th>
<th>Description</th>
<th>Qt's support</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>BMP</td>
<td>Windows Bitmap</td>
<td>Read/write</td>
</tr>
<tr class="even" valign="top">
<td>GIF</td>
<td>Graphic Interchange Format (optional)</td>
<td>Read</td>
</tr>
<tr class="odd" valign="top">
<td>JPG</td>
<td>Joint Photographic Experts Group</td>
<td>Read/write</td>
</tr>
<tr class="even" valign="top">
<td>JPEG</td>
<td>Joint Photographic Experts Group</td>
<td>Read/write</td>
</tr>
<tr class="odd" valign="top">
<td>PNG</td>
<td>Portable Network Graphics</td>
<td>Read/write</td>
</tr>
<tr class="even" valign="top">
<td>PBM</td>
<td>Portable Bitmap</td>
<td>Read</td>
</tr>
<tr class="odd" valign="top">
<td>PGM</td>
<td>Portable Graymap</td>
<td>Read</td>
</tr>
<tr class="even" valign="top">
<td>PPM</td>
<td>Portable Pixmap</td>
<td>Read/write</td>
</tr>
<tr class="odd" valign="top">
<td>XBM</td>
<td>X11 Bitmap</td>
<td>Read/write</td>
</tr>
<tr class="even" valign="top">
<td>XPM</td>
<td>X11 Pixmap</td>
<td>Read/write</td>
</tr>
</table>
<a id="pixmap-information" name="pixmap-information" />
<h3>Pixmap Information</h3>
<p>QPixmap provides a collection of functions that can be used to
obtain a variety of information about the pixmap:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th />
<th>Available Functions</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>Geometry</td>
<td>The <a href="qpixmap.html#size">size</a>(), <a href="qpixmap.html#width">width</a>() and <a href="qpixmap.html#height">height</a>() functions provide information
about the pixmap's size. The <a href="qpixmap.html#rect">rect</a>()
function returns the image's enclosing rectangle.</td>
</tr>
<tr class="even" valign="top">
<td>Alpha component</td>
<td>The <a href="qpixmap.html#hasAlphaChannel">hasAlphaChannel</a>() returns true
if the pixmap has a format that respects the alpha channel,
otherwise returns false. The <a href="qpixmap.html#hasAlpha">hasAlpha</a>(), <a href="qpixmap.html#setMask">setMask</a>() and <a href="qpixmap.html#mask">mask</a>() functions are legacy and should not
be used. They are potentially very slow.
<p>The <a href="qpixmap.html#createHeuristicMask">createHeuristicMask</a>()
function creates and returns a 1-bpp heuristic mask (i.e. a
<a href="qbitmap.html">QBitmap</a>) for this pixmap. It works by
selecting a color from one of the corners and then chipping away
pixels of that color, starting at all the edges. The <a href="qpixmap.html#createMaskFromColor">createMaskFromColor</a>()
function creates and returns a mask (i.e. a <a href="qbitmap.html">QBitmap</a>) for the pixmap based on a given
color.</p>
</td>
</tr>
<tr class="odd" valign="top">
<td>Low-level information</td>
<td>The <a href="qpixmap.html#depth">depth</a>() function returns
the depth of the pixmap. The <a href="qpixmap.html#defaultDepth">defaultDepth</a>() function returns the
default depth, i.e. the depth used by the application on the given
screen.
<p>The <a href="qpixmap.html#cacheKey">cacheKey</a>() function
returns a number that uniquely identifies the contents of the
QPixmap object.</p>
<p>The <a href="qpixmap.html#x11Info">x11Info</a>() function
returns information about the configuration of the X display used
by the screen to which the pixmap currently belongs. The <a href="qpixmap.html#x11PictureHandle">x11PictureHandle</a>() function
returns the X11 Picture handle of the pixmap for XRender support.
Note that the two latter functions are only available on x11.</p>
</td>
</tr>
</table>
<a id="pixmap-conversion" name="pixmap-conversion" />
<h3>Pixmap Conversion</h3>
<p>A QPixmap object can be converted into a <a href="qimage.html">QImage</a> using the <a href="qpixmap.html#toImage">toImage</a>() function. Likewise, a <a href="qimage.html">QImage</a> can be converted into a QPixmap using the
<a href="qpixmap.html#fromImage">fromImage</a>(). If this is too
expensive an operation, you can use <a href="qbitmap.html#fromImage">QBitmap.fromImage</a>() instead.</p>
<p>In addition, on Windows, the QPixmap class supports conversion
to and from HBITMAP: the <a href="qpixmap.html#toWinHBITMAP">toWinHBITMAP</a>() function creates a
HBITMAP equivalent to the QPixmap, based on the given <a href="qpixmap.html#HBitmapFormat-enum">HBitmapFormat</a>, and returns
the HBITMAP handle. The <a href="qpixmap.html#fromWinHBITMAP">fromWinHBITMAP</a>() function returns
a QPixmap that is equivalent to the given bitmap which has the
specified format. The QPixmap class also supports conversion to and
from HICON: the <a href="qpixmap.html#toWinHICON">toWinHICON</a>()
function creates a HICON equivalent to the QPixmap, and returns the
HICON handle. The <a href="qpixmap.html#fromWinHICON">fromWinHICON</a>() function returns a
QPixmap that is equivalent to the given icon.</p>
<p>In addition, on Symbian, the QPixmap class supports conversion
to and from CFbsBitmap: the <a href="qpixmap.html#toSymbianCFbsBitmap">toSymbianCFbsBitmap</a>()
function creates CFbsBitmap equivalent to the QPixmap, based on
given mode and returns a CFbsBitmap object. The <a href="qpixmap.html#fromSymbianCFbsBitmap">fromSymbianCFbsBitmap</a>()
function returns a QPixmap that is equivalent to the given bitmap
and given mode.</p>
<a id="pixmap-transformations" name="pixmap-transformations" />
<h3>Pixmap Transformations</h3>
<p>QPixmap supports a number of functions for creating a new pixmap
that is a transformed version of the original:</p>
<p>The <a href="qpixmap.html#scaled">scaled</a>(), <a href="qpixmap.html#scaledToWidth">scaledToWidth</a>() and <a href="qpixmap.html#scaledToHeight">scaledToHeight</a>() functions return
scaled copies of the pixmap, while the <a href="qpixmap.html#copy">copy</a>() function creates a QPixmap that is a
plain copy of the original one.</p>
<p>The <a href="qpixmap.html#transformed">transformed</a>()
function returns a copy of the pixmap that is transformed with the
given transformation matrix and transformation mode: Internally,
the transformation matrix is adjusted to compensate for unwanted
translation, i.e. <a href="qpixmap.html#transformed">transformed</a>() returns the smallest
pixmap containing all transformed points of the original pixmap.
The static <a href="qpixmap.html#trueMatrix">trueMatrix</a>()
function returns the actual matrix used for transforming the
pixmap.</p>
<p><b>Note:</b> When using the native X11 graphics system, the
pixmap becomes invalid when the <a href="qapplication.html">QApplication</a> instance is destroyed.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ShareMode-enum" />QPixmap.ShareMode</h3><p>This enum type defines the share modes that are available when
creating a <a href="qpixmap.html">QPixmap</a> object from a raw X11
Pixmap handle.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPixmap.ImplicitlyShared</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">This mode will cause the <a href="qpixmap.html">QPixmap</a> object to create a copy of the internal
data before it is modified, thus keeping the original X11 pixmap
intact.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPixmap.ExplicitlyShared</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">In this mode, the pixmap data will <i>not</i>
be copied before it is modified, which in effect will change the
original X11 pixmap.</td>
</tr>
</table>
<p><b>Warning:</b> This enum is only used for X11 specific
functions; using it is non-portable.</p>
<p>This enum was introduced or modified in Qt 4.5.</p>
<p><b>See also</b> <a href="qpixmap.html#fromX11Pixmap">QPixmap.fromX11Pixmap</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPixmap" />QPixmap.__init__ (<i>self</i>)</h3><p>Constructs a null pixmap.</p>
<p><b>See also</b> <a href="qpixmap.html#isNull">isNull</a>().</p>


<h3 class="fn"><a name="QPixmap-2" />QPixmap.__init__ (<i>self</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><h3 class="fn"><a name="QPixmap-3" />QPixmap.__init__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><p>Constructs a pixmap with the given <i>width</i> and
<i>height</i>. If either <i>width</i> or <i>height</i> is zero, a
null pixmap is constructed.</p>
<p><b>Warning:</b> This will create a <a href="qpixmap.html">QPixmap</a> with uninitialized data. Call <a href="qpixmap.html#fill">fill</a>() to fill the pixmap with an
appropriate color before drawing onto it with <a href="qpainter.html">QPainter</a>.</p>
<p><b>See also</b> <a href="qpixmap.html#isNull">isNull</a>().</p>


<h3 class="fn"><a name="QPixmap-4" />QPixmap.__init__ (<i>self</i>, QString&#160;<i>fileName</i>, str&#160;<i>format</i>&#160;=&#160;None, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>Constructs a pixmap from the file with the given
<i>fileName</i>. If the file does not exist or is of an unknown
format, the pixmap becomes a null pixmap.</p>
<p>The loader attempts to read the pixmap using the specified
<i>format</i>. If the <i>format</i> is not specified (which is the
default), the loader probes the file for a header to guess the file
format.</p>
<p>The file name can either refer to an actual file on disk or to
one of the application's embedded resources. See the <a href="resources.html">Resource System</a> overview for details on how to
embed images and other resource files in the application's
executable.</p>
<p>If the image needs to be modified to fit in a lower-resolution
result (e.g. converting from 32-bit to 8-bit), use the <i>flags</i>
to control the conversion.</p>
<p>The <i>fileName</i>, <i>format</i> and <i>flags</i> parameters
are passed on to <a href="qpixmap.html#load">load</a>(). This means
that the data in <i>fileName</i> is not compiled into the binary.
If <i>fileName</i> contains a relative path (e.g. the filename
only) the relevant file must be found relative to the runtime
working directory.</p>
<p><b>See also</b> <a href="qpixmap.html#reading-and-writing-image-files">Reading and Writing
Image Files</a>.</p>


<h3 class="fn"><a name="QPixmap-5" />QPixmap.__init__ (<i>self</i>, list-of-str&#160;<i>xpm</i>)</h3><p>Constructs a pixmap from the given <i>xpm</i> data, which must
be a valid XPM image.</p>
<p>Errors are silently ignored.</p>
<p>Note that it's possible to squeeze the XPM variable a little bit
by using an unusual declaration:</p>
<pre class="cpp">
 <span class="keyword">static</span> <span class="keyword">const</span> <span class="type">char</span> <span class="operator">*</span> <span class="keyword">const</span> start_xpm<span class="operator">[</span><span class="operator">]</span><span class="operator">=</span>{
     <span class="string">"16 15 8 1"</span><span class="operator">,</span>
     <span class="string">"a c #cec6bd"</span><span class="operator">,</span>
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
</pre>
<p>The extra <tt>const</tt> makes the entire definition read-only,
which is slightly more efficient (for example, when the code is in
a shared library) and ROMable when the application is to be stored
in ROM.</p>


<h3 class="fn"><a name="QPixmap-6" />QPixmap.__init__ (<i>self</i>, <a href="qpixmap.html">QPixmap</a>)</h3><p>Constructs a pixmap that is a copy of the given
<i>pixmap</i>.</p>
<p><b>See also</b> <a href="qpixmap.html#copy">copy</a>().</p>


<h3 class="fn"><a name="QPixmap-7" />QPixmap.__init__ (<i>self</i>, QVariant&#160;<i>variant</i>)</h3><h3 class="fn"><a name="alphaChannel" /><a href="qpixmap.html">QPixmap</a> QPixmap.alphaChannel (<i>self</i>)</h3><h3 class="fn"><a name="cacheKey" />int QPixmap.cacheKey (<i>self</i>)</h3><p>Returns a number that identifies this <a href="qpixmap.html">QPixmap</a>. Distinct <a href="qpixmap.html">QPixmap</a> objects can only have the same cache key
if they refer to the same contents.</p>
<p>The cacheKey() will change when the pixmap is altered.</p>


<h3 class="fn"><a name="convertFromImage" />bool QPixmap.convertFromImage (<i>self</i>, <a href="qimage.html">QImage</a>&#160;<i>img</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>Replaces this pixmap's data with the given <i>image</i> using
the specified <i>flags</i> to control the conversion. The
<i>flags</i> argument is a bitwise-OR of the <a href="qt.html#ImageConversionFlag-enum">Qt.ImageConversionFlags</a>.
Passing 0 for <i>flags</i> sets all the default options. Returns
true if the result is that this pixmap is not null.</p>
<p>Note: this function was part of Qt 3 support in Qt 4.6 and
earlier. It has been promoted to official API status in 4.7 to
support updating the pixmap's image without creating a new <a href="qpixmap.html">QPixmap</a> as <a href="qpixmap.html#fromImage">fromImage</a>() would.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qpixmap.html#fromImage">fromImage</a>().</p>


<h3 class="fn"><a name="copy" /><a href="qpixmap.html">QPixmap</a> QPixmap.copy (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>&#160;=&#160;QRect())</h3><p>Returns a deep copy of the subset of the pixmap that is
specified by the given <i>rectangle</i>. For more information on
deep copies, see the <a href="implicit-sharing.html#implicit-data-sharing">Implicit Data
Sharing</a> documentation.</p>
<p>If the given <i>rectangle</i> is empty, the whole image is
copied.</p>
<p><b>See also</b> <a href="qpixmap.html#operator-eq">operator=</a>(), <a href="qpixmap.html#QPixmap">QPixmap</a>(), and <a href="qpixmap.html#pixmap-transformations">Pixmap
Transformations</a>.</p>


<h3 class="fn"><a name="copy-2" /><a href="qpixmap.html">QPixmap</a> QPixmap.copy (<i>self</i>, int&#160;<i>ax</i>, int&#160;<i>ay</i>, int&#160;<i>awidth</i>, int&#160;<i>aheight</i>)</h3><p>This is an overloaded function.</p>
<p>Returns a deep copy of the subset of the pixmap that is
specified by the rectangle <a href="qrect.html">QRect</a>(
<i>x</i>, <i>y</i>, <i>width</i>, <i>height</i>).</p>


<h3 class="fn"><a name="createHeuristicMask" /><a href="qbitmap.html">QBitmap</a> QPixmap.createHeuristicMask (<i>self</i>, bool&#160;<i>clipTight</i>&#160;=&#160;True)</h3><p>Creates and returns a heuristic mask for this pixmap.</p>
<p>The function works by selecting a color from one of the corners
and then chipping away pixels of that color, starting at all the
edges. If <i>clipTight</i> is true (the default) the mask is just
large enough to cover the pixels; otherwise, the mask is larger
than the data pixels.</p>
<p>The mask may not be perfect but it should be reasonable, so you
can do things such as the following:</p>
<pre class="cpp">
 <span class="type"><a href="qpixmap.html">QPixmap</a></span> myPixmap;
 myPixmap<span class="operator">-</span><span class="operator">&gt;</span>setMask(myPixmap<span class="operator">-</span><span class="operator">&gt;</span>createHeuristicMask());
</pre>
<p>This function is slow because it involves converting to/from a
<a href="qimage.html">QImage</a>, and non-trivial computations.</p>
<p><b>See also</b> <a href="qimage.html#createHeuristicMask">QImage.createHeuristicMask</a>()
and <a href="qpixmap.html#createMaskFromColor">createMaskFromColor</a>().</p>


<h3 class="fn"><a name="createMaskFromColor" /><a href="qbitmap.html">QBitmap</a> QPixmap.createMaskFromColor (<i>self</i>, <a href="qcolor.html">QColor</a>&#160;<i>maskColor</i>, <a href="qt.html#MaskMode-enum">Qt.MaskMode</a>&#160;<i>mode</i>)</h3><p>Creates and returns a mask for this pixmap based on the given
<i>maskColor</i>. If the <i>mode</i> is <a href="qt.html#MaskMode-enum">Qt.MaskInColor</a>, all pixels matching
the maskColor will be transparent. If <i>mode</i> is <a href="qt.html#MaskMode-enum">Qt.MaskOutColor</a>, all pixels matching
the maskColor will be opaque.</p>
<p>This function is slow because it involves converting to/from a
<a href="qimage.html">QImage</a>.</p>
<p><b>See also</b> <a href="qpixmap.html#createHeuristicMask">createHeuristicMask</a>() and
<a href="qimage.html#createMaskFromColor">QImage.createMaskFromColor</a>().</p>


<h3 class="fn"><a name="createMaskFromColor-2" /><a href="qbitmap.html">QBitmap</a> QPixmap.createMaskFromColor (<i>self</i>, <a href="qcolor.html">QColor</a>&#160;<i>maskColor</i>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a mask for this pixmap based on the given
<i>maskColor</i>. Same as calling createMaskFromColor(maskColor,
<a href="qt.html#MaskMode-enum">Qt.MaskInColor</a>)</p>
<p><b>See also</b> <a href="qpixmap.html#createHeuristicMask">createHeuristicMask</a>() and
<a href="qimage.html#createMaskFromColor">QImage.createMaskFromColor</a>().</p>


<h3 class="fn"><a name="defaultDepth" />int QPixmap.defaultDepth ()</h3><p>Returns the default pixmap depth used by the application.</p>
<p>On Windows and Mac, the default depth is always 32. On X11 and
embedded, the depth of the screen will be returned by this
function.</p>
<p><b>See also</b> <a href="qpixmap.html#depth">depth</a>(),
<a href="qcolormap.html#depth">QColormap.depth</a>(), and <a href="qpixmap.html#pixmap-information">Pixmap Information</a>.</p>


<h3 class="fn"><a name="depth" />int QPixmap.depth (<i>self</i>)</h3><p>Returns the depth of the pixmap.</p>
<p>The pixmap depth is also called bits per pixel (bpp) or bit
planes of a pixmap. A null pixmap has depth 0.</p>
<p><b>See also</b> <a href="qpixmap.html#defaultDepth">defaultDepth</a>() and <a href="qpixmap.html#pixmap-information">Pixmap Information</a>.</p>


<h3 class="fn"><a name="detach" />QPixmap.detach (<i>self</i>)</h3><p>Detaches the pixmap from shared pixmap data.</p>
<p>A pixmap is automatically detached by Qt whenever its contents
are about to change. This is done in almost all <a href="qpixmap.html">QPixmap</a> member functions that modify the pixmap
(<a href="qpixmap.html#fill">fill</a>(), <a href="qpixmap.html#fromImage">fromImage</a>(), <a href="qpixmap.html#load">load</a>(), etc.), and in <a href="qpainter.html#begin">QPainter.begin</a>() on a pixmap.</p>
<p>There are two exceptions in which detach() must be called
explicitly, that is when calling the <a href="qpixmap.html#handle">handle</a>() or the <a href="qpixmap.html#x11PictureHandle">x11PictureHandle</a>() function
(only available on X11). Otherwise, any modifications done using
system calls, will be performed on the shared data.</p>
<p>The detach() function returns immediately if there is just a
single reference or if the pixmap has not been initialized yet.</p>


<h3 class="fn"><a name="devType" />int QPixmap.devType (<i>self</i>)</h3><h3 class="fn"><a name="fill" />QPixmap.fill (<i>self</i>, <a href="qcolor.html">QColor</a>&#160;<i>color</i>&#160;=&#160;Qt.white)</h3><p>Fills the pixmap with the given <i>color</i>.</p>
<p>The effect of this function is undefined when the pixmap is
being painted on.</p>
<p><b>See also</b> <a href="qpixmap.html#pixmap-transformations">Pixmap
Transformations</a>.</p>


<h3 class="fn"><a name="fill-2" />QPixmap.fill (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qpoint.html">QPoint</a>&#160;<i>ofs</i>)</h3><p>Fills the pixmap with the <i>widget</i>'s background color or
pixmap according to the given offset.</p>
<p>The <a href="qpoint.html">QPoint</a> <i>offset</i> defines a
point in widget coordinates to which the pixmap's top-left pixel
will be mapped to. This is only significant if the widget has a
background pixmap; otherwise the pixmap will simply be filled with
the background color of the widget.</p>


<h3 class="fn"><a name="fill-3" />QPixmap.fill (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, int&#160;<i>xofs</i>, int&#160;<i>yofs</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the pixmap with the <i>widget</i>'s background color or
pixmap. The given point, (<i>x</i>, <i>y</i>), defines an offset in
widget coordinates to which the pixmap's top-left pixel will be
mapped to.</p>


<h3 class="fn"><a name="fromImage" /><a href="qpixmap.html">QPixmap</a> QPixmap.fromImage (<a href="qimage.html">QImage</a>&#160;<i>image</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>Converts the given <i>image</i> to a pixmap using the specified
<i>flags</i> to control the conversion. The <i>flags</i> argument
is a bitwise-OR of the <a href="qt.html#ImageConversionFlag-enum">Qt.ImageConversionFlags</a>.
Passing 0 for <i>flags</i> sets all the default options.</p>
<p>In case of monochrome and 8-bit images, the image is first
converted to a 32-bit pixmap and then filled with the colors in the
color table. If this is too expensive an operation, you can use
<a href="qbitmap.html#fromImage">QBitmap.fromImage</a>()
instead.</p>
<p><b>See also</b> <a href="qpixmap.html#fromImageReader">fromImageReader</a>(), <a href="qpixmap.html#toImage">toImage</a>(), and <a href="qpixmap.html#pixmap-conversion">Pixmap Conversion</a>.</p>


<h3 class="fn"><a name="fromImageReader" /><a href="qpixmap.html">QPixmap</a> QPixmap.fromImageReader (<a href="qimagereader.html">QImageReader</a>&#160;<i>imageReader</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>Create a <a href="qpixmap.html">QPixmap</a> from an image read
directly from an <i>imageReader</i>. The <i>flags</i> argument is a
bitwise-OR of the <a href="qt.html#ImageConversionFlag-enum">Qt.ImageConversionFlags</a>.
Passing 0 for <i>flags</i> sets all the default options.</p>
<p>On some systems, reading an image directly to <a href="qpixmap.html">QPixmap</a> can use less memory than reading a
<a href="qimage.html">QImage</a> to convert it to <a href="qpixmap.html">QPixmap</a>.</p>
<p><b>See also</b> <a href="qpixmap.html#fromImage">fromImage</a>(), <a href="qpixmap.html#toImage">toImage</a>(), and <a href="qpixmap.html#pixmap-conversion">Pixmap Conversion</a>.</p>


<h3 class="fn"><a name="fromX11Pixmap" /><a href="qpixmap.html">QPixmap</a> QPixmap.fromX11Pixmap (int&#160;<i>pixmap</i>, <a href="qpixmap.html#ShareMode-enum">ShareMode</a>&#160;<i>mode</i>&#160;=&#160;QPixmap.ImplicitlyShared)</h3><p>Creates a <a href="qpixmap.html">QPixmap</a> from the native X11
Pixmap handle <i>pixmap</i>, using <i>mode</i> as the share mode.
The default share mode is <a href="qpixmap.html#ShareMode-enum">QPixmap.ImplicitlyShared</a>, which
means that a copy of the pixmap is made if someone tries to modify
it by e.g. drawing onto it.</p>
<p><a href="qpixmap.html">QPixmap</a> does <i>not</i> take
ownership of the <i>pixmap</i> handle, and have to be deleted by
the user.</p>
<p><b>Warning:</b> This function is X11 specific; using it is
non-portable.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qpixmap.html#ShareMode-enum">QPixmap.ShareMode</a>.</p>


<h3 class="fn"><a name="grabWidget" /><a href="qpixmap.html">QPixmap</a> QPixmap.grabWidget (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>)</h3><p>Creates a pixmap and paints the given <i>widget</i>, restricted
by the given <i>rectangle</i>, in it. If the <i>widget</i> has any
children, then they are also painted in the appropriate
positions.</p>
<p>If no rectangle is specified (the default) the entire widget is
painted.</p>
<p>If <i>widget</i> is 0, the specified rectangle doesn't overlap
the widget's rectangle, or an error occurs, the function will
return a null <a href="qpixmap.html">QPixmap</a>. If the rectangle
is a superset of the given <i>widget</i>, the areas outside the
<i>widget</i> are covered with the widget's background.</p>
<p>This function actually asks <i>widget</i> to paint itself (and
its children to paint themselves) by calling paintEvent() with
painter redirection turned on. But <a href="qpixmap.html">QPixmap</a> also provides the <a href="qpixmap.html#grabWindow">grabWindow</a>() function which is a bit
faster by grabbing pixels directly off the screen. In addition, if
there are overlaying windows, <a href="qpixmap.html#grabWindow">grabWindow</a>(), unlike grabWidget(),
will see them.</p>
<p><b>Warning:</b> Do not grab a widget from its <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>(). However, it is
safe to grab a widget from another widget's <a href="qwidget.html#paintEvent">paintEvent()</a>.</p>
<p><b>See also</b> <a href="qpixmap.html#grabWindow">grabWindow</a>().</p>


<h3 class="fn"><a name="grabWidget-2" /><a href="qpixmap.html">QPixmap</a> QPixmap.grabWidget (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, int&#160;<i>x</i>&#160;=&#160;0, int&#160;<i>y</i>&#160;=&#160;0, int&#160;<i>width</i>&#160;=&#160;-1, int&#160;<i>height</i>&#160;=&#160;-1)</h3><p>This is an overloaded function.</p>
<p>Creates a pixmap and paints the given <i>widget</i>, restricted
by <a href="qrect.html">QRect</a>(<i>x</i>, <i>y</i>, <i>width</i>,
<i>height</i>), in it.</p>
<p><b>Warning:</b> Do not grab a widget from its <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>(). However, it is
safe to grab a widget from another widget's <a href="qwidget.html#paintEvent">paintEvent()</a>.</p>


<h3 class="fn"><a name="grabWindow" /><a href="qpixmap.html">QPixmap</a> QPixmap.grabWindow (int&#160;<i>window</i>, int&#160;<i>x</i>&#160;=&#160;0, int&#160;<i>y</i>&#160;=&#160;0, int&#160;<i>width</i>&#160;=&#160;-1, int&#160;<i>height</i>&#160;=&#160;-1)</h3><p>Creates and returns a pixmap constructed by grabbing the
contents of the given <i>window</i> restricted by <a href="qrect.html">QRect</a>(<i>x</i>, <i>y</i>, <i>width</i>,
<i>height</i>).</p>
<p>The arguments (<i>x</i>, <i>y</i>) specify the offset in the
window, whereas (<i>width</i>, <i>height</i>) specify the area to
be copied. If <i>width</i> is negative, the function copies
everything to the right border of the window. If <i>height</i> is
negative, the function copies everything to the bottom of the
window.</p>
<p>The window system identifier (<tt>WId</tt>) can be retrieved
using the <a href="qwidget.html#winId">QWidget.winId</a>()
function. The rationale for using a window identifier and not a
<a href="qwidget.html">QWidget</a>, is to enable grabbing of
windows that are not part of the application, window system frames,
and so on.</p>
<p>The grabWindow() function grabs pixels from the screen, not from
the window, i.e. if there is another window partially or entirely
over the one you grab, you get pixels from the overlying window,
too. The mouse cursor is generally not grabbed.</p>
<p>Note on X11 that if the given <i>window</i> doesn't have the
same depth as the root window, and another window partially or
entirely obscures the one you grab, you will <i>not</i> get pixels
from the overlying window. The contents of the obscured areas in
the pixmap will be undefined and uninitialized.</p>
<p>On Windows Vista and above grabbing a layered window, which is
created by setting the <a href="qt.html#WidgetAttribute-enum">Qt.WA_TranslucentBackground</a>
attribute, will not work. Instead grabbing the desktop widget
should work.</p>
<p><b>Warning:</b> In general, grabbing an area outside the screen
is not safe. This depends on the underlying window system.</p>
<p><b>See also</b> <a href="qpixmap.html#grabWidget">grabWidget</a>() and <a href="desktop-screenshot.html">Screenshot Example</a>.</p>


<h3 class="fn"><a name="handle" />int QPixmap.handle (<i>self</i>)</h3><p>Returns the pixmap's handle to the device context.</p>
<p>Note that, since <a href="qpixmap.html">QPixmap</a> make use of
<a href="implicit-sharing.html#implicit-data-sharing">implicit data
sharing</a>, the <a href="qpixmap.html#detach">detach</a>()
function must be called explicitly to ensure that only <i>this</i>
pixmap's data is modified if the pixmap data is shared.</p>
<p><b>Warning:</b> This function is X11 specific; using it is
non-portable.</p>
<p><b>Warning:</b> Since 4.8, pixmaps do not have an X11 handle
unless created with <a href="qpixmap.html#fromX11Pixmap">fromX11Pixmap()</a>, or if the native
graphics system is explicitly enabled.</p>
<p><b>See also</b> <a href="qpixmap.html#detach">detach</a>() and
<a href="qapplication.html#setGraphicsSystem">QApplication.setGraphicsSystem</a>().</p>


<h3 class="fn"><a name="hasAlpha" />bool QPixmap.hasAlpha (<i>self</i>)</h3><p>Returns true if this pixmap has an alpha channel, <i>or</i> has
a mask, otherwise returns false.</p>
<p><b>See also</b> <a href="qpixmap.html#hasAlphaChannel">hasAlphaChannel</a>() and <a href="qpixmap.html#mask">mask</a>().</p>


<h3 class="fn"><a name="hasAlphaChannel" />bool QPixmap.hasAlphaChannel (<i>self</i>)</h3><p>Returns true if the pixmap has a format that respects the alpha
channel, otherwise returns false.</p>
<p><b>See also</b> <a href="qpixmap.html#hasAlpha">hasAlpha</a>().</p>


<h3 class="fn"><a name="height" />int QPixmap.height (<i>self</i>)</h3><p>Returns the height of the pixmap.</p>
<p><b>See also</b> <a href="qpixmap.html#size">size</a>() and
<a href="qpixmap.html#pixmap-information">Pixmap
Information</a>.</p>


<h3 class="fn"><a name="isNull" />bool QPixmap.isNull (<i>self</i>)</h3><p>Returns true if this is a null pixmap; otherwise returns
false.</p>
<p>A null pixmap has zero width, zero height and no contents. You
cannot draw in a null pixmap.</p>


<h3 class="fn"><a name="isQBitmap" />bool QPixmap.isQBitmap (<i>self</i>)</h3><p>Returns true if this is a <a href="qbitmap.html">QBitmap</a>;
otherwise returns false.</p>


<h3 class="fn"><a name="load" />bool QPixmap.load (<i>self</i>, QString&#160;<i>fileName</i>, str&#160;<i>format</i>&#160;=&#160;None, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>Loads a pixmap from the file with the given <i>fileName</i>.
Returns true if the pixmap was successfully loaded; otherwise
returns false.</p>
<p>The loader attempts to read the pixmap using the specified
<i>format</i>. If the <i>format</i> is not specified (which is the
default), the loader probes the file for a header to guess the file
format.</p>
<p>The file name can either refer to an actual file on disk or to
one of the application's embedded resources. See the <a href="resources.html">Resource System</a> overview for details on how to
embed pixmaps and other resource files in the application's
executable.</p>
<p>If the data needs to be modified to fit in a lower-resolution
result (e.g. converting from 32-bit to 8-bit), use the <i>flags</i>
to control the conversion.</p>
<p>Note that QPixmaps are automatically added to the <a href="qpixmapcache.html">QPixmapCache</a> when loaded from a file; the
key used is internal and can not be acquired.</p>
<p><b>See also</b> <a href="qpixmap.html#loadFromData">loadFromData</a>() and <a href="qpixmap.html#reading-and-writing-image-files">Reading and Writing
Image Files</a>.</p>


<h3 class="fn"><a name="loadFromData" />bool QPixmap.loadFromData (<i>self</i>, str&#160;<i>buf</i>, str&#160;<i>format</i>&#160;=&#160;None, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>Loads a pixmap from the <i>len</i> first bytes of the given
binary <i>data</i>. Returns true if the pixmap was loaded
successfully; otherwise returns false.</p>
<p>The loader attempts to read the pixmap using the specified
<i>format</i>. If the <i>format</i> is not specified (which is the
default), the loader probes the file for a header to guess the file
format.</p>
<p>If the data needs to be modified to fit in a lower-resolution
result (e.g. converting from 32-bit to 8-bit), use the <i>flags</i>
to control the conversion.</p>
<p><b>See also</b> <a href="qpixmap.html#load">load</a>() and
<a href="qpixmap.html#reading-and-writing-image-files">Reading and
Writing Image Files</a>.</p>


<h3 class="fn"><a name="loadFromData-2" />bool QPixmap.loadFromData (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>buf</i>, str&#160;<i>format</i>&#160;=&#160;None, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><h3 class="fn"><a name="mask" /><a href="qbitmap.html">QBitmap</a> QPixmap.mask (<i>self</i>)</h3><p>Extracts a bitmap mask from the pixmap's alpha channel.</p>
<p><b>Warning:</b> This is potentially an expensive operation. The
mask of the pixmap is extracted dynamically from the pixeldata.</p>
<p><b>See also</b> <a href="qpixmap.html#setMask">setMask</a>() and
<a href="qpixmap.html#pixmap-information">Pixmap
Information</a>.</p>


<h3 class="fn"><a name="metric" />int QPixmap.metric (<i>self</i>, <a href="qpaintdevice.html#PaintDeviceMetric-enum">QPaintDevice.PaintDeviceMetric</a>)</h3><h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPixmap.paintEngine (<i>self</i>)</h3><h3 class="fn"><a name="rect" /><a href="qrect.html">QRect</a> QPixmap.rect (<i>self</i>)</h3><p>Returns the pixmap's enclosing rectangle.</p>
<p><b>See also</b> <a href="qpixmap.html#pixmap-information">Pixmap
Information</a>.</p>


<h3 class="fn"><a name="save" />bool QPixmap.save (<i>self</i>, QString&#160;<i>fileName</i>, str&#160;<i>format</i>&#160;=&#160;None, int&#160;<i>quality</i>&#160;=&#160;-1)</h3><p>Saves the pixmap to the file with the given <i>fileName</i>
using the specified image file <i>format</i> and <i>quality</i>
factor. Returns true if successful; otherwise returns false.</p>
<p>The <i>quality</i> factor must be in the range [0,100] or -1.
Specify 0 to obtain small compressed files, 100 for large
uncompressed files, and -1 to use the default settings.</p>
<p>If <i>format</i> is 0, an image format will be chosen from
<i>fileName</i>'s suffix.</p>
<p><b>See also</b> <a href="qpixmap.html#reading-and-writing-image-files">Reading and Writing
Image Files</a>.</p>


<h3 class="fn"><a name="save-2" />bool QPixmap.save (<i>self</i>, <a href="qiodevice.html">QIODevice</a>&#160;<i>device</i>, str&#160;<i>format</i>&#160;=&#160;None, int&#160;<i>quality</i>&#160;=&#160;-1)</h3><p>This is an overloaded function.</p>
<p>This function writes a <a href="qpixmap.html">QPixmap</a> to the
given <i>device</i> using the specified image file <i>format</i>
and <i>quality</i> factor. This can be used, for example, to save a
pixmap directly into a <a href="qbytearray.html">QByteArray</a>:</p>
<pre class="cpp">
         <span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap;
         <span class="type"><a href="qbytearray.html">QByteArray</a></span> bytes;
         <span class="type"><a href="qbuffer.html">QBuffer</a></span> buffer(<span class="operator">&amp;</span>bytes);
         buffer<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">.</span>WriteOnly);
         pixmap<span class="operator">.</span>save(<span class="operator">&amp;</span>buffer<span class="operator">,</span> <span class="string">"PNG"</span>); <span class="comment">// writes pixmap into bytes in PNG format</span>
</pre>


<h3 class="fn"><a name="scaled" /><a href="qpixmap.html">QPixmap</a> QPixmap.scaled (<i>self</i>, int&#160;<i>width</i>, int&#160;<i>height</i>, <a href="qt.html#AspectRatioMode-enum">Qt.AspectRatioMode</a>&#160;<i>aspectRatioMode</i>&#160;=&#160;Qt.IgnoreAspectRatio, <a href="qt.html#TransformationMode-enum">Qt.TransformationMode</a>&#160;<i>transformMode</i>&#160;=&#160;Qt.FastTransformation)</h3><p>Scales the pixmap to the given <i>size</i>, using the aspect
ratio and transformation modes specified by <i>aspectRatioMode</i>
and <i>transformMode</i>.</p>
<p class="centerAlign"><img src="images/qimage-scaling.png" /></p>
<ul>
<li>If <i>aspectRatioMode</i> is <a href="qt.html#AspectRatioMode-enum">Qt.IgnoreAspectRatio</a>, the
pixmap is scaled to <i>size</i>.</li>
<li>If <i>aspectRatioMode</i> is <a href="qt.html#AspectRatioMode-enum">Qt.KeepAspectRatio</a>, the pixmap
is scaled to a rectangle as large as possible inside <i>size</i>,
preserving the aspect ratio.</li>
<li>If <i>aspectRatioMode</i> is <a href="qt.html#AspectRatioMode-enum">Qt.KeepAspectRatioByExpanding</a>,
the pixmap is scaled to a rectangle as small as possible outside
<i>size</i>, preserving the aspect ratio.</li>
</ul>
<p>If the given <i>size</i> is empty, this function returns a null
pixmap.</p>
<p>In some cases it can be more beneficial to draw the pixmap to a
painter with a scale set rather than scaling the pixmap. This is
the case when the painter is for instance based on OpenGL or when
the scale factor changes rapidly.</p>
<p><b>See also</b> <a href="qpixmap.html#isNull">isNull</a>() and
<a href="qpixmap.html#pixmap-transformations">Pixmap
Transformations</a>.</p>


<h3 class="fn"><a name="scaled-2" /><a href="qpixmap.html">QPixmap</a> QPixmap.scaled (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>size</i>, <a href="qt.html#AspectRatioMode-enum">Qt.AspectRatioMode</a>&#160;<i>aspectRatioMode</i>&#160;=&#160;Qt.IgnoreAspectRatio, <a href="qt.html#TransformationMode-enum">Qt.TransformationMode</a>&#160;<i>transformMode</i>&#160;=&#160;Qt.FastTransformation)</h3><p>This is an overloaded function.</p>
<p>Returns a copy of the pixmap scaled to a rectangle with the
given <i>width</i> and <i>height</i> according to the given
<i>aspectRatioMode</i> and <i>transformMode</i>.</p>
<p>If either the <i>width</i> or the <i>height</i> is zero or
negative, this function returns a null pixmap.</p>


<h3 class="fn"><a name="scaledToHeight" /><a href="qpixmap.html">QPixmap</a> QPixmap.scaledToHeight (<i>self</i>, int&#160;<i>height</i>, <a href="qt.html#TransformationMode-enum">Qt.TransformationMode</a>&#160;<i>mode</i>&#160;=&#160;Qt.FastTransformation)</h3><p>Returns a scaled copy of the image. The returned image is scaled
to the given <i>height</i> using the specified transformation
<i>mode</i>. The width of the pixmap is automatically calculated so
that the aspect ratio of the pixmap is preserved.</p>
<p>If <i>height</i> is 0 or negative, a null pixmap is
returned.</p>
<p><b>See also</b> <a href="qpixmap.html#isNull">isNull</a>() and
<a href="qpixmap.html#pixmap-transformations">Pixmap
Transformations</a>.</p>


<h3 class="fn"><a name="scaledToWidth" /><a href="qpixmap.html">QPixmap</a> QPixmap.scaledToWidth (<i>self</i>, int&#160;<i>width</i>, <a href="qt.html#TransformationMode-enum">Qt.TransformationMode</a>&#160;<i>mode</i>&#160;=&#160;Qt.FastTransformation)</h3><p>Returns a scaled copy of the image. The returned image is scaled
to the given <i>width</i> using the specified transformation
<i>mode</i>. The height of the pixmap is automatically calculated
so that the aspect ratio of the pixmap is preserved.</p>
<p>If <i>width</i> is 0 or negative, a null pixmap is returned.</p>
<p><b>See also</b> <a href="qpixmap.html#isNull">isNull</a>() and
<a href="qpixmap.html#pixmap-transformations">Pixmap
Transformations</a>.</p>


<h3 class="fn"><a name="scroll" /><a href="qregion.html">QRegion</a>&#160;<i>exposed</i> QPixmap.scroll (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>)</h3><p>This convenience function is equivalent to calling
QPixmap.scroll(<i>dx</i>, <i>dy</i>, <a href="qrect.html">QRect</a>(<i>x</i>, <i>y</i>, <i>width</i>,
<i>height</i>), <i>exposed</i>).</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qwidget.html#scroll">QWidget.scroll</a>() and <a href="qgraphicsitem.html#scroll">QGraphicsItem.scroll</a>().</p>


<h3 class="fn"><a name="scroll-2" /><a href="qregion.html">QRegion</a>&#160;<i>exposed</i> QPixmap.scroll (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>width</i>, int&#160;<i>height</i>)</h3><p>Scrolls the area <i>rect</i> of this pixmap by (<i>dx</i>,
<i>dy</i>). The exposed region is left unchanged. You can
optionally pass a pointer to an empty <a href="qregion.html">QRegion</a> to get the region that is <i>exposed</i>
by the scroll operation.</p>
<pre class="cpp">
 <span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap(<span class="string">"background.png"</span>);
 <span class="type"><a href="qregion.html">QRegion</a></span> exposed;
 pixmap<span class="operator">.</span>scroll(<span class="number">10</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> pixmap<span class="operator">.</span>rect()<span class="operator">,</span> <span class="operator">&amp;</span>exposed);
</pre>
<p>You cannot scroll while there is an active painter on the
pixmap.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qwidget.html#scroll">QWidget.scroll</a>() and <a href="qgraphicsitem.html#scroll">QGraphicsItem.scroll</a>().</p>


<h3 class="fn"><a name="serialNumber" />int QPixmap.serialNumber (<i>self</i>)</h3><h3 class="fn"><a name="setAlphaChannel" />QPixmap.setAlphaChannel (<i>self</i>, <a href="qpixmap.html">QPixmap</a>)</h3><h3 class="fn"><a name="setMask" />QPixmap.setMask (<i>self</i>, <a href="qbitmap.html">QBitmap</a>)</h3><p>Sets a mask bitmap.</p>
<p>This function merges the <i>mask</i> with the pixmap's alpha
channel. A pixel value of 1 on the mask means the pixmap's pixel is
unchanged; a value of 0 means the pixel is transparent. The mask
must have the same size as this pixmap.</p>
<p>Setting a null mask resets the mask, leaving the previously
transparent pixels black. The effect of this function is undefined
when the pixmap is being painted on.</p>
<p><b>Warning:</b> This is potentially an expensive operation.</p>
<p><b>See also</b> <a href="qpixmap.html#mask">mask</a>(), <a href="qpixmap.html#pixmap-transformations">Pixmap Transformations</a>,
and <a href="qbitmap.html">QBitmap</a>.</p>


<h3 class="fn"><a name="size" /><a href="qsize.html">QSize</a> QPixmap.size (<i>self</i>)</h3><p>Returns the size of the pixmap.</p>
<p><b>See also</b> <a href="qpixmap.html#width">width</a>(),
<a href="qpixmap.html#height">height</a>(), and <a href="qpixmap.html#pixmap-information">Pixmap Information</a>.</p>


<h3 class="fn"><a name="toImage" /><a href="qimage.html">QImage</a> QPixmap.toImage (<i>self</i>)</h3><p>Converts the pixmap to a <a href="qimage.html">QImage</a>.
Returns a null image if the conversion fails.</p>
<p>If the pixmap has 1-bit depth, the returned image will also be 1
bit deep. Images with more bits will be returned in a format
closely represents the underlying system. Usually this will be
<a href="qimage.html#Format-enum">QImage.Format_ARGB32_Premultiplied</a>
for pixmaps with an alpha and <a href="qimage.html#Format-enum">QImage.Format_RGB32</a> or <a href="qimage.html#Format-enum">QImage.Format_RGB16</a> for pixmaps
without alpha.</p>
<p>Note that for the moment, alpha masks on monochrome images are
ignored.</p>
<p><b>See also</b> <a href="qpixmap.html#fromImage">fromImage</a>()
and <a href="qimage.html#image-formats">Image Formats</a>.</p>


<h3 class="fn"><a name="transformed" /><a href="qpixmap.html">QPixmap</a> QPixmap.transformed (<i>self</i>, <a href="qmatrix.html">QMatrix</a>&#160;<i>matrix</i>, <a href="qt.html#TransformationMode-enum">Qt.TransformationMode</a>&#160;<i>mode</i>&#160;=&#160;Qt.FastTransformation)</h3><p>Returns a copy of the pixmap that is transformed using the given
transformation <i>transform</i> and transformation <i>mode</i>. The
original pixmap is not changed.</p>
<p>The transformation <i>transform</i> is internally adjusted to
compensate for unwanted translation; i.e. the pixmap produced is
the smallest pixmap that contains all the transformed points of the
original pixmap. Use the <a href="qpixmap.html#trueMatrix">trueMatrix</a>() function to retrieve the
actual matrix used for transforming the pixmap.</p>
<p>This function is slow because it involves transformation to a
<a href="qimage.html">QImage</a>, non-trivial computations and a
transformation back to a <a href="qpixmap.html">QPixmap</a>.</p>
<p><b>See also</b> <a href="qpixmap.html#trueMatrix">trueMatrix</a>() and <a href="qpixmap.html#pixmap-transformations">Pixmap
Transformations</a>.</p>


<h3 class="fn"><a name="transformed-2" /><a href="qpixmap.html">QPixmap</a> QPixmap.transformed (<i>self</i>, <a href="qtransform.html">QTransform</a>&#160;<i>transform</i>, <a href="qt.html#TransformationMode-enum">Qt.TransformationMode</a>&#160;<i>mode</i>&#160;=&#160;Qt.FastTransformation)</h3><p>This is an overloaded function.</p>
<p>This convenience function loads the <i>matrix</i> into a
<a href="qtransform.html">QTransform</a> and calls the overloaded
function.</p>


<h3 class="fn"><a name="trueMatrix" /><a href="qmatrix.html">QMatrix</a> QPixmap.trueMatrix (<a href="qmatrix.html">QMatrix</a>&#160;<i>m</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><p>Returns the actual matrix used for transforming a pixmap with
the given <i>width</i>, <i>height</i> and <i>matrix</i>.</p>
<p>When transforming a pixmap using the <a href="qpixmap.html#transformed">transformed</a>() function, the
transformation matrix is internally adjusted to compensate for
unwanted translation, i.e. <a href="qpixmap.html#transformed">transformed</a>() returns the smallest
pixmap containing all transformed points of the original pixmap.
This function returns the modified matrix, which maps points
correctly from the original pixmap into the new pixmap.</p>
<p><b>See also</b> <a href="qpixmap.html#transformed">transformed</a>() and <a href="qpixmap.html#pixmap-transformations">Pixmap
Transformations</a>.</p>


<h3 class="fn"><a name="trueMatrix-2" /><a href="qtransform.html">QTransform</a> QPixmap.trueMatrix (<a href="qtransform.html">QTransform</a>&#160;<i>m</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><p>This is an overloaded function.</p>
<p>This convenience function loads the matrix <i>m</i> into a
<a href="qtransform.html">QTransform</a> and calls the overloaded
function with the <a href="qtransform.html">QTransform</a> and the
width <i>w</i> and the height <i>h</i>.</p>


<h3 class="fn"><a name="width" />int QPixmap.width (<i>self</i>)</h3><p>Returns the width of the pixmap.</p>
<p><b>See also</b> <a href="qpixmap.html#size">size</a>() and
<a href="qpixmap.html#pixmap-information">Pixmap
Information</a>.</p>


<h3 class="fn"><a name="x11Info" /><a href="qx11info.html">QX11Info</a> QPixmap.x11Info (<i>self</i>)</h3><p><b>X11 only:</b> Returns information about the configuration of
the X display used by the screen to which the pixmap currently
belongs.</p>
<p><b>Warning:</b> This function is only available on X11.</p>
<p><b>See also</b> <a href="qpixmap.html#pixmap-information">Pixmap
Information</a>.</p>


<h3 class="fn"><a name="x11PictureHandle" />int QPixmap.x11PictureHandle (<i>self</i>)</h3><p><b>X11 only:</b> Returns the X11 Picture handle of the pixmap
for XRender support.</p>
<p>This function will return 0 if XRender support is not compiled
into Qt, if the XRender extension is not supported on the X11
display, or if the handle could not be created. Use of this
function is not portable.</p>
<p><b>Warning:</b> This function is only available on X11.</p>
<p><b>See also</b> <a href="qpixmap.html#pixmap-information">Pixmap
Information</a>.</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>